package com.dxg.msns.common.pojo;

import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * 歌单音乐关联实体类
 * 对应数据库表：playlist_music
 * 
 * @author system
 */
@Table(name = "playlist_music")
public class PlaylistMusic implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 歌单ID
     */
    @Id
    @Column(name = "playlist_id")
    private String playlistId;

    /**
     * 音乐ID
     */
    @Id
    @Column(name = "music_id")
    private String musicId;

    // 构造方法
    public PlaylistMusic() {
    }

    public PlaylistMusic(String playlistId, String musicId) {
        this.playlistId = playlistId;
        this.musicId = musicId;
    }

    // Getter 和 Setter 方法
    public String getPlaylistId() {
        return playlistId;
    }

    public void setPlaylistId(String playlistId) {
        this.playlistId = playlistId;
    }

    public String getMusicId() {
        return musicId;
    }

    public void setMusicId(String musicId) {
        this.musicId = musicId;
    }

    @Override
    public String toString() {
        return "PlaylistMusic{" +
                "playlistId='" + playlistId + '\'' +
                ", musicId='" + musicId + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        PlaylistMusic that = (PlaylistMusic) o;

        if (!playlistId.equals(that.playlistId))
            return false;
        return musicId.equals(that.musicId);
    }

    @Override
    public int hashCode() {
        int result = playlistId.hashCode();
        result = 31 * result + musicId.hashCode();
        return result;
    }
}